package app.kernel.server;

//package org.apache.xmlrpc.demo.webserver;

import java.net.InetAddress;

import kernel.udp.server.UDPServer;


import psg.servicemanager.*;
import psg.queryprocessor.*;

public class PublicServer {
	
    public static int port = 8001;



    private UDPServer u;
    
    
    public void start() throws Exception{
    	u.start();
    	//webServer.start();	
    }
    
    public PublicServer(int incomingPort) throws Exception {
    	
    	port = incomingPort;
        
      
        

    	System.out.println("[ "+config.config.resourceName+" ] "+"[ Server ] Preparing Resource.");
    	System.out.println("[ "+config.config.resourceName+" ] "+"[ Server ] Starting Resource Package on Localhost ["+incomingPort+"]");    	
  	  	u = new UDPServer(incomingPort); 	  	
        u.addHandler("QueryP2P",
                app.kernel.api.McsAPI.class);       
        u.addHandler("RequestsManager",
                app.kernel.data.RequestsManager.class);
        u.addHandler("PSG_Manager",
                app.kernel.psgManager.PSG_Manager.class);

  	  	
  	  	System.out.println("[ "+config.config.resourceName+" ] "+"[ Server ] Ready.\n\n");
        u.start();
        
        
        
        
        u.start();
        
    }
    

}
